package com.example.boot08.mapper;

import com.example.boot08.entity.Product;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @Name: ProductMapper
 * @Author: 西风残叶
 * @Company: 朝兮网络工作室
 * @Data: 2023/11/12 19:01
 */
@Mapper
public interface ProductMapper {
    @Select("select id ,title , price,num from product")
    List<Product> select();

    @Insert("insert into product values (null,#{title},#{price},#{num})")
    void insert(Product product);

    @Delete("delete from product where id=#{id}")
    void deleteByid(int id);

    @Update("update product set title=#{title},price=#{price},num=#{num} where id =#{id}")
    void update(Product product);

    @Select("select id ,title,price,num from product where id=#{id}")
    Product selectById(int id);
}
